/*
 * OWL - OCaml Scientific and Engineering Computing
 * Copyright (c) 2016-2020 Liang Wang <liang.wang@cl.cam.ac.uk>
 */

#ifndef OWL_CORE_ENGINE_H
#define OWL_CORE_ENGINE_H

#include "owl_aeos_params_generated.h"

// threshold of the ndarray size to trigger openmp
#define OWL_OMP_THRESHOLD_DEFAULT 100000


#ifdef _OPENMP
  // choose OpenMP engine
  #define OWL_MATRIX_SWAP_IMPL   "owl_matrix_swap_impl_omp.h"
  #define OWL_NDARRAY_MATHS_CMP  "owl_ndarray_maths_cmp_omp.h"
  #define OWL_NDARRAY_MATHS_MAP  "owl_ndarray_maths_map_omp.h"
  #define OWL_NDARRAY_MATHS_FOLD "owl_ndarray_maths_fold_omp.h"
  #define OWL_SLICING_BASIC_IMPL "owl_slicing_basic_impl_omp.h"

#else
  // choose CPU engine
  #define OWL_MATRIX_SWAP_IMPL   "owl_matrix_swap_impl.h"
  #define OWL_NDARRAY_MATHS_CMP  "owl_ndarray_maths_cmp.h"
  #define OWL_NDARRAY_MATHS_MAP  "owl_ndarray_maths_map.h"
  #define OWL_NDARRAY_MATHS_FOLD "owl_ndarray_maths_fold.h"
  #define OWL_SLICING_BASIC_IMPL "owl_slicing_basic_impl.h"

#endif  /* _OPENMP */


/* Default tunable OpemMP parameters */

#define OWL_OMP_THRESHOLD_FUN_(A) OMP_THRESHOLD ## _ ## A
#define OWL_OMP_THRESHOLD_FUN(A) OWL_OMP_THRESHOLD_FUN_(A)

#ifndef OWL_AEOS_PARAMS_H

#define OWL_OMP_THRESHOLD_RECI OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ABS OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ABS2 OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SIGNUM OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SQR OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SQRT OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_CBRT OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_EXP OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_EXPM1 OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_LOG OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_LOG1P OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SIN OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_COS OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_TAN OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ASIN OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ACOS OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ATAN OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SINH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_COSH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_TANH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ASINH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ACOSH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ATANH OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ERF OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_ERFC OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_LOGISTIC OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_RELU OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SOFTPLUS OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SOFTSIGN OWL_OMP_THRESHOLD_DEFAULT

#define OWL_OMP_THRESHOLD_SIGMOID OWL_OMP_THRESHOLD_DEFAULT

#endif


#endif  /* OWL_CORE_ENGINE_H */
